package com.neuedu.weishi.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;
import org.springframework.stereotype.Repository;

import com.neuedu.weishi.entity.VideoComment;
import com.neuedu.weishi.mapper.VideoCommentMapper;
import com.neuedu.weishi.service.IVideoCommentService;

import java.util.List;

@Service("videoCommentService")
public class VideoCommentServiceImpl implements IVideoCommentService {

    @Autowired
    @Qualifier("videoCommentMapper")
    private VideoCommentMapper videoCommentMapper;

    @Override
    public List<VideoComment> selectList(VideoComment videoComment){
        QueryWrapper<VideoComment> queryWrapper = new QueryWrapper<>();
        return videoCommentMapper.selectList(queryWrapper);
    }

    @Override
    public IPage<VideoComment> selectPage(IPage<VideoComment> page){
        QueryWrapper<VideoComment> queryWrapper = new QueryWrapper<>();
        return videoCommentMapper.selectPage(page, queryWrapper);
    }

    @Override
    public VideoComment selectById(Integer commentId) {
        return videoCommentMapper.selectById(commentId);
    }

    @Override
    public int deleteById(Integer commentId) {
        return videoCommentMapper.deleteById(commentId);
    }

    @Override
    public int delete(VideoComment videoComment){
        QueryWrapper<VideoComment> queryWrapper = new QueryWrapper<>();
        return videoCommentMapper.delete(queryWrapper);
    }

    @Override
    public int insert(VideoComment videoComment) {
        return videoCommentMapper.insert( videoComment);
    }

    @Override
    public int updateById(VideoComment videoComment) {
        return videoCommentMapper.updateById(videoComment);
    }

    @Override
    public int update(VideoComment videoComment) {
        UpdateWrapper<VideoComment> updateWrapper = new UpdateWrapper<>();
        return videoCommentMapper.update(videoComment,updateWrapper);
    }
}